import { default as db } from '$lib/server/database';
import { error } from '@sveltejs/kit';

/** @type {import('./$types').PageServerLoad} */
export async function load({ params }: { params: { slug: string } }) {
	console.log(params);
	const slug = params.slug;
	const article = await db.get(slug)
	if (article) {
		return {
			article: article
		};
	}
	console.log("err")
	throw error(404, 'Not found');
}
